const On_Event = [
    "onClick",
    "onDblclick",
    "onMousedown",
    "onMousemove",
    "onMouseup",
    "onMouseover",
    "onMouseout",
    "onGlobalout",
    "onContextmenu",
    "onHighlight",
    "onDownplay",
    "onSelectchanged",
    "onLegendselectchanged",
    "onLegendselected",
    "onLegendunselected",
    "onLegendselectall",
    "onLegendinverseselect",
    "onLegendscroll",
    "onDatazoom",
    "onDatarangeselected",
    "onGraphroam",
    "onGeoroam",
    "onTreeroam",
    "onTimelinechanged",
    "onTimelineplaychanged",
    "onRestore",
    "onDataviewchanged",
    "onMagictypechanged",
    "onGeoselectchanged",
    "onGeoselected",
    "onGeounselected",
    "onAxisareaselected",
    "onBrush",
    "onBrushEnd",
    "onBrushselected",
    "onGlobalcursortaken",
    "onRendered",
    "onFinished",
];

export const useChartEvents = (events, chart) => {
    Object.keys(events)
        .filter((keys) =>
            On_Event.map((x) => x.substring(2).toLowerCase()).includes(keys)
        )
        .forEach((item) => chart.on(item, events[item]));
};
